﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace QuanLyKhachHang.Data
{
    class TTNhomKhachHang
    {
        public string MaNhomKhachHang, TenNhomKhachHang;
        public TTNhomKhachHang() { }
        public TTNhomKhachHang(string MaNhomKhachHang, string TenNhomKhachHang)
        {
            this.MaNhomKhachHang = MaNhomKhachHang;
            this.TenNhomKhachHang = TenNhomKhachHang;
        }
    }

    class NVNhomKhachHang
    {
        public static DataTable ChonTatCa()
        {
            return Connect.cnSQL.ExecQuery("Select * from NhomKhachHang");
        }
        public static bool Them(TTNhomKhachHang NhomKhachHang)
        {
            Connect.cnSQL.ExecNonQuery("Insert into NhomKhachHang values('" + NhomKhachHang.MaNhomKhachHang + "',N'" + NhomKhachHang.TenNhomKhachHang  + "')");
            return (!Connect.Tools.CoLoi);
        }
        public static bool Sua(TTNhomKhachHang NhomKhachHang)
        {
            Connect.cnSQL.ExecNonQuery("Update NhomKhachHang Set TenNhomKhachHang=N'" + NhomKhachHang.TenNhomKhachHang + "'  where MaNhomKhachHang='" + NhomKhachHang.MaNhomKhachHang + "'");
            return (!Connect.Tools.CoLoi);
        }
        public static bool Xoa(string Ma)
        {
            Connect.cnSQL.ExecNonQuery("Delete NhomKhachHang where MaNhomKhachHang ='" + Ma + "'");
            return (!Connect.Tools.CoLoi);
        }
    }
}
